/*
 * PageStatic.java
 *
 * Created on 2008��2��21��, ����1:34
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package orest.common.util;

import java.net.*;
import java.io.*;

/**
 *
 * @author Yandd
 */
public class PageStatic {
    
    /** Creates a new instance of PageStatic */
    public PageStatic() {
    }
    
    public String getPageHTMLStrByURL(String remoteurl) {
        String sURLAddress = remoteurl;
        URL    url = null;
        StringBuffer returnStr = new StringBuffer();
        try{
            url = new URL(sURLAddress);
        }catch(MalformedURLException e){
            System.err.println(e.toString());
        }
        
        try{
            InputStream ins = url.openStream();
            BufferedReader breader = new BufferedReader(new InputStreamReader(ins));
            String info = breader.readLine();
            
            while(info != null){
                returnStr.append(info);
                info  = breader.readLine();
            }
            return returnStr.toString();
            
        } catch(IOException e){
            System.err.println(e.toString());
            //System.exit(1);
            return null;
        }
    }
    
}
